<?php

class contactoActions extends sfActions {



    
    public function executeContactanos(sfWebRequest $request)
    {
            $this->successMessage = $request->getParameter('sendSuccess',"error");
    }
    public function executeSend_email(sfWebRequest $request)
    {

            $name     =  $request->getParameter('nombre');
            $direccion    =  $request->getParameter('direccion');
            $telefono   =  $request->getParameter('telefono');     
            $email  =  $request->getParameter('email');     
            $messageText  =  $request->getParameter('comentario');    
            
           try{           
                $message = $this->getMailer()->compose();
                $message->setSubject('Contacto Ipdt');
                
                
                $message->setTo("cesar.quevedo.vega@gmail.com");
                $message->setFrom(array('lllcesarlll@hotmail.com' => 'Ipdt contacto'));
                $html = $this->getPartial('contacto/sendEmail', array(
                        'name'=>$name,
                        'direccion'=>$direccion,
                        'telefono'=>$telefono,
                        'email'=>$email,
                        'message'=>$messageText
                ));
                $message->setBody($html, 'text/html');
                $this->getMailer()->send($message);
               
                
            }catch (Exception $e){
                
            }
        
            $this->redirect('@homepage_contacto?sendSuccess=success');
        
    }
    

    }
